package com.v.im.webservice.controller.base;

import com.v.im.commonmodule.utils.bean.CurrentUserInfo;
import com.v.im.commonmodule.utils.utils.JsonUtils;
import com.v.im.webservice.service.iface.IImUserService;
import com.v.im.webservice.service.iface.IUserPushService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * @author wym
 * @create 2019-01-24 12:49
 **/
public class BaseController {

    @Autowired
    protected IUserPushService userPushService;

    @Autowired
    protected IImUserService imUserService;

    protected CurrentUserInfo getCurrentUserInfo(HttpServletRequest request){
        CurrentUserInfo currentUserInfo = null;
        String json = request.getHeader("CURRENT_USER_INFO");
        if (StringUtils.isNotBlank(json)) {
            currentUserInfo = JsonUtils.serializable(json, CurrentUserInfo.class);
        }
        return currentUserInfo;
    }

}
